package com.lfy.Factor.comm.abs.dfg;

import com.lfy.aop.tre;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class RegisterTre implements BeanPostProcessor {
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if(beanName.equals("treImpl1")){
            System.out.println("tre");
        }
        boolean b = bean instanceof Tre;
        boolean annotationPresent = bean.getClass().isAnnotationPresent(tre.class);
        if(b && annotationPresent){
            ghj.getInstance().register((Tre) bean);
        }
        return BeanPostProcessor.super.postProcessAfterInitialization(bean, beanName);
    }
}
